'user strict';
import React, {Component} from 'react';
import {
    TouchableOpacity,
    View,
    Image,
    Text,
} from 'react-native';
import Global from "../Commom/GlobalConst";
const {width, height} = Global.Const.size;
class SomethingItemView extends Component {

    onItemClick(id){
        let {navigator,name,component} = this.props;
        navigator.push({
            id:name,
            component,
            passProps: {
                ID: id,
            },
        })
    }

    render() {
        let {item,textColor} = this.props;
        let color = textColor ? textColor : '#999';
        return (
            <TouchableOpacity style={{width:width/3-10,alignItems: 'center'}}
                              onPress={() => this.onItemClick(item.id)}>
                <View style={{width:width/3-10,alignItems: 'center'}}>
                    <Image style={{width: 90, height: 90}} source={{uri:item.images}}/>
                    <Text numberOfLines={1}
                          style={{
                              width: 90,
                              textAlign: 'center',
                              fontSize: 12,
                              marginTop: 5,
                              color: '#333'
                          }}>{item.title}</Text>

                </View>
            </TouchableOpacity>
        )
    }

}

SomethingItemView.propTypes = {
    item: React.PropTypes.object.isRequired,
    navigator: React.PropTypes.object.isRequired,
    component: React.PropTypes.func.isRequired,
    name: React.PropTypes.string.isRequired,
};

export default SomethingItemView;